package budget.control

class UploadFileController {

	def transactionReaderService
	
    def index() { }
	
	
	def upload() {
		def f = request.getFile('myFile')
		if (f.empty) {
			flash.message = 'file cannot be empty'
			render(view: 'index')
			return
		}
		def file = new File('/!dev/myfile.txt')
		f.transferTo(file)
		f.transferTo(file)
		transactionReaderService.process(file)
		
		
		//response.sendError(200, 'Done')
		flash.message = "upload successful"
		render(view: 'index')
	}
}
